﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using TyNetCoreBlog.Models.Data;

namespace TyNetCoreBlog.Repository.RepositoryWrapper
{
    public class RepositoryWrapper : IRepositoryWrapper
    {
        private IUserRepository _userRepository = null;
        private IBlogRepository _blogRepository = null;
        private ICategoryRepository _categoryRepository = null;
        private ITagRepository _tagRepository = null;
        private IFriendlylinkRepository _friendlylink = null;

        public AppDbContext DbContext { get; }
        public RepositoryWrapper(AppDbContext dbContext)
        {
            DbContext = dbContext;
        }

        public IUserRepository User => _userRepository ?? new UserRepository(DbContext);
        public IBlogRepository Blog => _blogRepository ?? new BlogRepository(DbContext);
        public ICategoryRepository Category => _categoryRepository ?? new CategoryRepository(DbContext);
        public ITagRepository Tag => _tagRepository ?? new TagRepository(DbContext);
        public IFriendlylinkRepository Friendlylink => _friendlylink ?? new FriendlylinkRepository(DbContext);

    }
}
